<?php
session_start();
require('../conn.php');
require('../functions.php');
require('admin.php');
if ($_POST) {
    $id = guolv($_POST['id']);
    $name = guolv($_POST['name']);
    $type = guolv($_POST['type']);
    $remark = guolv($_POST['remark']);
    $state = guolv($_POST['state']);
    $res = $mysql->execute("update `sharesite` set `name`='{$name}',`type`='{$type}',`remark`='{$remark}',`state`='{$state}'where `id`='{$id}'");
    if ($res) {
        echo "<script>alert('修改成功');location.href='edit_sharesite.php?id={$id}'</script>";
        exit;
    }
} ?>
<?php include('head.php') ?>
<link rel="stylesheet" href="../editor/themes/default/default.css"/>
<link rel="stylesheet" href="../editor/plugins/code/prettify.css"/>
<script src="<?php echo $jquerysite ?>" type="text/javascript"></script>
<script charset="utf-8" src="../editor/kindeditor.js"></script>
<script charset="utf-8" src="../editor/lang/zh_CN.js"></script>
<script charset="utf-8" src="../editor/plugins/code/prettify.js"></script>
<div class="container-fluid">

    <div class="row-fluid">
        <?php
        include('left.php'); ?>
        <div class="span9">
            <h1 class="page-title">分享域名修改</h1>

            <div class="well">
                <ul class="nav nav-tabs">
                    <li class="active"><a href="#home" data-toggle="tab">设置</a></li>
                </ul>
                <div id="myTabContent" class="tab-content">
                    <div class="tab-pane active in" id="home">
                        <form id="tab" action="edit_sharesite.php" method="post">
                            <?php
                            $id = guolv($_GET['id']);
                            $row = $mysql->query("select d.* from `sharesite` d where d.`id`='{$id}' limit 1");
                            if (!$row) {
                                _location('sharesite.php', 301);
                                exit;
                            } else {
                                $data = $row[0];
                            } ?>
                            <input type="hidden" name="id" value="<?php echo $id ?>">
                            <label>域名：</label>
                            <input type="text" style="width:300px" name="name" value="<?php echo $data['name'] ?>">
                            <code>如：www.baidu.com（开头不要带http://）</code>
                            <label>类型：</label>
                            <input type="text" style="width:300px" name="type" value="<?php echo $data['type'] ?>">
                            <label>备注：</label>
                            <input type="text" style="width:300px" name="remark" value="<?php echo $data['remark'] ?>">
                            <label>状态：</label>
                            <select name="state">
                                <option value="0" <?php echo $data['state'] == 0 ? 'selected="selected"' : '' ?>>未使用
                                </option>
                                <option value="1" <?php echo $data['state'] == 1 ? 'selected="selected"' : '' ?>>使用中
                                </option>
                                <option value="2" <?php echo $data['state'] == 2 ? 'selected="selected"' : '' ?>>微信屏蔽
                                </option>
                                <option value="3" <?php echo $data['state'] == 3 ? 'selected="selected"' : '' ?>>已删除
                                </option>
                            </select>

                            <label></label>
                            <button class="btn btn-primary"><i class="icon-save"></i> 修改</button>
                        </form>
                    </div>
                </div>

            </div>
        </div>
    </div>


</div>

<footer>
    <hr>

    <p class="pull-right"><!--power by right--></p>


    <p><!--power by --></p>
</footer>

<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="lib/bootstrap/js/bootstrap.js"></script>


</body>
</html>